LINK CONSOLE - BEN RYVES 2007
-----------------------------

What is it?
-----------
This is a very crude link console program. You hook it up to another device
that speaks the Texas Instruments linking protocol, and you can send data to
it by typing on your calculator keypad. Received text is displayed on the
screen.

What's it for?
--------------
Really, as an interactive console when working with the VMusic2 mod.

What are the limitations?
-------------------------
Both \r and \n are handled as newline characters.
Pressing Enter sends \r; this is for VMusic2 compatibility. It is easy to
change the key mapping in the source file.

How do I use it?
----------------
Send it to your calculator. Type on the keypad. Look at the screen. That's
about it. :) Clear quits.

Typing is strange. Rather than have "sticky" states, you'll need to use 2nd
and Alpha like the modifiers on your PC keyboard.

In default mode, typing is in text mode. Typing is sent as lowercase text.
eg, typing [x^-1][x][*] sends "dir".

Holding [2nd] is the same as the shift key on your keyboard, ie, holding
[2nd] and typing the above sends "DIR".

Holding [Alpha] enables number mode, where you send the number on keys.

Holding [2nd]+[Alpha] sends a few other "special" keys.

In default mode, [.] sends ".", NOT its alpha-shifted ":".

[3] doesn't send theta; it sends a "~" by default (no LFN support on VMusic)
and a "_" when shifted.

I hope you'll find it faintly intuitive.

To send raw bytes in hex, hit [Mode]. a '$' prompt appears; type the two hex
digits (eg, [Mode][0][x^-1] sends $0D, aka '\r').

If a byte can't be sent for any reason, a ? is displayed (either instead of
it or after the hex prompt).

Example
-------
This is for the VMusic2 device.

Start the program with the hardware connected but no disk inserted. Insert a
disk, and the following should appear on-screen when the indicator LED turns
green:

No Upgrade
D:\>

Type in 'SCS' (without quotes) and press enter to use the short command set:

scs
>

Let's get the disk free space. Press [Mode], enter $12, press [Enter] and
immediately hold [On] (so the response is shown in hexadecimal):

$12
$00$40$E3$02$0D$3E$0D

Now, $3E is '>' and thus our command prompt, so we can ignore that.
The first four bytes are free space, LSB first, so I have $02E34000 bytes
of free space on my drive (that comes to ~46.20MB).

Return to extended command mode:

ecs
D:\>

Let's see what the disk is like. Try the 'idd' command:

idd

USB VID = $0D7D
USB PID = $1320
Vendor ID = 
Product ID = USB DISK Pro
Revision Level = 1.1B
I/F = SCSI
FAT32
Bytes/Sector = $0200
Bytes/Cluster = $000400
Capacity = $07984000 Bytes
Free Space = $02E34000 Bytes

D:\>

How about creating a file?
First, open a file for writing.

opw hello.txt
D:\>

Let's write "Hello" to the text file. Hello is five characters long. First,
type in 'wrf' and a space (write to file). Now enter four hex bytes; $00,
$00, $00 and $05 (we're writing five bytes). Press [Enter].

Now type 'Hello'. When you have typed the final 'o' the prompt should
reappear. Close the file with 'clf'.

wrf $00$00$00$05
HelloD:\>
clf hello.txt
D:\>

You can read the entire file back using the 'rd' command.

rd hello.txt
HelloD:\>